<script>
import { toLogin } from "./service/login";
export default {
  onLaunch: function () {
    wx.login({
      success: async (res) => {
        let result = await toLogin(res.code);
        console.log(111,res,result);
        if (result.msg === "获取openid成功") {
          wx.setStorage({
            key: "token",
            data: result.data.openid,
          });
        }
      },
    });
  },
  onShow: function () {
    console.log("App Show");
  },
  onHide: function () {
    console.log("App Hide");
  },
};
</script>

<style>
/*每个页面公共css */
@import "/wxcomponents/vant/common/index.wxss";
</style>
